package 多线程;

/**
 * @ClassName: Demo03
 * @Auther: Drawin
 * @Date: 2021/11/22 16:13
 * @Description:
 */

public class Demo03 extends Thread{
    public void run(){
        for (int i =1; i <=100; i++) {
            System.out.println(Thread.currentThread().getName()+"第"+i+"次运行");
            Thread.yield();//让出CPU执行权
        }
    }

    public static void main(String[] args) {
        Demo03 t1=new Demo03();
        Demo03 t2=new Demo03();
        Demo03 t3 = new Demo03();
        t1.setPriority(Thread.MAX_PRIORITY);
        t2.setPriority(Thread.NORM_PRIORITY);
        t3.setPriority(Thread.MIN_PRIORITY);
        t1.start();t2.start();t3.start();
    }
}
